package com.spring.springmvc;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.Set;

/**
 * @Description:
 * @Auther: zhibo
 * @Date: 2018/8/23 18:49
 */
public class BindingRequestAndModel {

    public static void bindingRequestAndModel(MyModelAndView myModelAndView, HttpServletRequest request) {

        MyModelMap myModelMap = myModelAndView.getModelMap();
        if (null !=myModelMap && !myModelMap.isEmpty()){
            Set<Map.Entry<String, Object>> entries1 = myModelMap.entrySet();
            for (Map.Entry<String, Object> entryMap :
                    entries1) {
                String key = entryMap.getKey();
                Object value = entryMap.getValue();
                request.setAttribute(key,value);
            }
        }

    }
}
